<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="parent">
        <div class="screen">0</div>
        <div class="ctrl" >
            <button id="plus">+</button>
            <button id="sub">-</button>
        </div>
    </div>

    <style>

        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .parent{
            width: 300px;
            height: 300px;
            background-color: gray;
            border-radius: 5px;
            margin: 0 auto;
        }

        .parent .screen{
            width: 200px;
            height: 150px;
            font-size: 50px;
            line-height: 150px;
            color: white;
            
            margin: 0 auto;
            text-align: center;
        }

        .parent .ctrl{
            width: 300px;
            height: 150px;
            margin: 0 auto;
            
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        .parent .ctrl button{
            width: 100px;
            height: 50px;
            font-size: 20px;
            line-height: 20px;
            text-align: center;
            border-radius: 10px;
            border: none;
        }

        .parent .ctrl button:active{
            color: white;
            background-color: rgb(255, 182, 47);
        }
    </style>

    <script>
        let plusButton = document.querySelector('#plus');
        plusButton.onclick = function(){
            //选中num
            let nums = document.querySelector('.screen');
            //读取nums
            let content = nums.innerHTML;
            //增加
            let ans = parseInt(content) + 1;
            //赋值
            nums.innerHTML = ans;
        } 

        // let subButton = document.querySelector('#sub');
        // subBotton.onclick = function(){
        //     //选中
        //     let nums = document.querySelector('.screen');
        //     //获值
        //     let content = nums.innerHTML;
        //     //减减
        //     let ans = parseInt(content) - 1;
        //     //赋值
        //     nums.innerHTML = ans;
        // }

        let subButton = document.querySelector('#sub');
        subButton.onclick = function(){
            //选中num
            let nums = document.querySelector('.screen');
            //读取nums
            let content = nums.innerHTML;
            //增加
            let ans = parseInt(content) - 1;
            //赋值
            nums.innerHTML = ans;
        } 
    </script>
</body>
</html>